# fetch_html.py
import urllib.request
from bs4 import BeautifulSoup

def fetch_html(url):
    try:
        resp = urllib.request.urlopen(url)
        html = resp.read().decode()
        soup = BeautifulSoup(html, "lxml")
        return soup
    except Exception as err:
        print(f"Error fetching HTML: {err}")
        return None
